package com.toocms.jinjuhang.ui.system

import androidx.databinding.ObservableArrayList
import androidx.databinding.ObservableField
import com.toocms.jinjuhang.R
import com.toocms.jinjuhang.BR
import com.toocms.jinjuhang.data.CommentItemData
import com.toocms.tab.base.BaseViewModel
import com.toocms.tab.base.ItemViewModel
import com.toocms.tab.binding.ItemBinding

class EvaluateItemModel(
    viewModel: BaseViewModel<*>,
    val item: (ObservableField<CommentItemData>) = ObservableField()
) :
    ItemViewModel<BaseViewModel<*>>(viewModel) {
    val imageItems by lazy {
        item.get()?.run {
            val result = ObservableArrayList<ImageItemModel>()
            pictures?.forEach {
                result += ImageItemModel(viewModel, pictures, ObservableField(it))
            }
            result
        }
    }
    val imageItemBinding = ItemBinding.of<ImageItemModel>(BR.imageItemModel, R.layout.item_image)

}